Structured errors 2: more error types#24
Merged
tpellissier-msft merged 4 commits intomainfrom Oct 22, 2025
Merged
Conversation
zhaodongwang-msft
approved these changes
Oct 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Copilot summary:
This pull request introduces structured error handling to the Dataverse SDK by adding custom error classes and subcodes, replacing generic exceptions with more descriptive, domain-specific errors. It also enhances HTTP error reporting with more details and improves validation and metadata error handling. Comprehensive tests are added to ensure proper error propagation and coverage.
Error Handling Enhancements
error_codes.pyfor validation, SQL parsing, and metadata operations, enabling more granular error reporting.ValidationError,MetadataError, andSQLParseError—inerrors.py, extendingDataverseErrorfor structured exception handling.DataverseErrorandHttpErrorconstructors to standardize error attributes, set default sources, and enrich HTTP error details (e.g., correlation IDs, retry-after, body excerpt). [1] [2]SDK Codebase Changes
RuntimeErrorandValueErrorwith the new custom error classes throughoutodata.py, providing more meaningful error messages and subcodes for validation and metadata errors. [1] [2] [3] [4] [5]_requestto extract error details from responses and map status codes to subcodes, with better transient error detection and retry-after support.Testing Improvements
tests/test_http_errors.pyto verify HTTP error handling, subcode mapping, transient detection, and error detail extraction.tests/test_logical_crud.pyto expectMetadataErrorinstead ofRuntimeErrorfor unknown logical names, reflecting the new error handling approach. [1] [2]